package com.norteksoft.erm.model;

import java.util.HashSet;
import java.util.Set;
import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * 数据分类维度
 * 
 * @hibernate.class table="ERM_DATADIMENSION"
 * @author Jiffy
 * 
 */
public class DataDimension extends BaseObject {

	private static final long serialVersionUID = -2695492763260641701L;

	public static final String TYPE_STRING = "string";

	public static final String TYPE_STRING_INTEGER = "sinteger";

	public static final String TYPE_STRING_DATE = "sdate";

	public static final String TYPE_STRING_FLOAT = "sfloat";

	public static final String TYPE_INTEGER = "integer";

	public static final String TYPE_FLOAT = "float";

	public static final String TYPE_LONG = "long";

	public static final String TYPE_DATE = "date";

	public static final String TYPE_TIMESSTAMP = "timesstamp";

	private Long OID = new Long(-1);// OID

	private String name;// 条件名称

	private String attribute;// 条件属性(java类属性)

	private String dbAttribute;// 条件属性对应的数据库/全文检索字段

	private String attributeType;// 属性数据类型

	private DataResource dataResource;// 所属数据资源类型

	private Set dataDomains = new HashSet();// 数据域集

	public int hashCode() {
		return new HashCodeBuilder().append(OID).append(name).append(attribute)
				.append(dbAttribute).append(attributeType).toHashCode();
	}

	/**
	 * @hibernate.id column="OID" unsaved-value="-1" type="long"
	 * @hibernate.generator class="sequence"
	 * @hibernate.param name="sequence" value="ERM_SEQUENCE"
	 */

	public Long getOID() {
		return OID;
	}

	public void setOID(Long oid) {
		OID = oid;
	}

	/**
	 * @hibernate.property column="NAME" length="60" type="string"
	 *                     not-null="true"
	 * @return String
	 */

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @hibernate.property column="ATTRIBUTE" length="60" type="string"
	 *                     not-null="true"
	 * @return String
	 */
	public String getAttribute() {
		return attribute;
	}

	public void setAttribute(String attribute) {
		this.attribute = attribute;
	}

	/**
	 * @hibernate.many-to-one name="dataResource" column="DATARESOURCEOID"
	 *                        class="com.norteksoft.erm.model.DataResource"
	 */
	public DataResource getDataResource() {
		return dataResource;
	}

	public void setDataResource(DataResource dataResource) {
		this.dataResource = dataResource;
	}

	/**
	 * @hibernate.set lazy="false" inverse="true" cascade="all-delete-orphan"
	 * @hibernate.key column="DATADIMENSIONOID"
	 * @hibernate.one-to-many class="com.norteksoft.erm.model.DataDomain"
	 * @return Set
	 */

	public Set getDataDomains() {
		return dataDomains;
	}

	public void setDataDomains(Set dataDomains) {
		this.dataDomains = dataDomains;
	}

	/**
	 * @hibernate.property column="ATTRIBUTETYPE" length="12" type="string"
	 *                     not-null="true"
	 * @return String
	 */
	public String getAttributeType() {
		return attributeType;
	}

	public void setAttributeType(String attributeType) {
		this.attributeType = attributeType;
	}

	/**
	 * @hibernate.property column="DBATTRIBUTE" length="60" type="string"
	 * @return String
	 */
	public String getDbAttribute() {
		return dbAttribute;
	}

	public void setDbAttribute(String dbAttribute) {
		this.dbAttribute = dbAttribute;
	}

}